package com.kuang.functionalInterface;

import java.util.function.Consumer;

/**
 * Cunsumer 消费型接口
 *      只有输入，没有返回，饕餮!
 */
public class Test3 {
    public static void main(String[] args) {
        Consumer<String> consumer = new Consumer<String>() {
            @Override
            public void accept(String s) {
                System.out.println(s);
            }
        };
        consumer.accept("测试");

        // lambda简化
        Consumer<String> consumer1 = (str) -> {System.out.println(str);};
        Consumer<String> consumer11 = System.out::println;
        consumer1.accept("简化测试");
        consumer11.accept("简化测试");
    }
}
